import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** AI批阅任务信息 */
export interface AiMarkingTask {
          id: number; // 任务ID
          taskCode?: string; // 任务编号
          paperId?: number; // 试卷ID
          taskType: string; // 任务类型
          taskStatus?: number; // 任务状态
          requestData: string; // 请求数据
          responseData: string; // 响应数据
          errorMessage: string; // 错误信息
          startedTime: string | Dayjs; // 开始时间
          completedTime: string | Dayjs; // 完成时间
  }

// AI批阅任务 API
export const AiMarkingTaskApi = {
  // 查询AI批阅任务分页
  getAiMarkingTaskPage: async (params: any) => {
    return await request.get({ url: `/exam/ai-marking-task/page`, params })
  },

  // 查询AI批阅任务详情
  getAiMarkingTask: async (id: number) => {
    return await request.get({ url: `/exam/ai-marking-task/get?id=` + id })
  },

  // 新增AI批阅任务
  createAiMarkingTask: async (data: AiMarkingTask) => {
    return await request.post({ url: `/exam/ai-marking-task/create`, data })
  },

  // 修改AI批阅任务
  updateAiMarkingTask: async (data: AiMarkingTask) => {
    return await request.put({ url: `/exam/ai-marking-task/update`, data })
  },

  // 删除AI批阅任务
  deleteAiMarkingTask: async (id: number) => {
    return await request.delete({ url: `/exam/ai-marking-task/delete?id=` + id })
  },

  /** 批量删除AI批阅任务 */
  deleteAiMarkingTaskList: async (ids: number[]) => {
    return await request.delete({ url: `/exam/ai-marking-task/delete-list?ids=${ids.join(',')}` })
  },

  // 导出AI批阅任务 Excel
  exportAiMarkingTask: async (params) => {
    return await request.download({ url: `/exam/ai-marking-task/export-excel`, params })
  },
}